﻿<!-- BEGIN MAIN CONTENT -->
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN: ACCORDION DEMO -->
        <div class="portlet light">
            <div class="portlet-title page-bar">
                <ul class="page-breadcrumb pull-right">
                    <li>
                        <i class="fa fa-home"></i>
                        <a href="#/home.html">管理中心</a>
                        <i class="fa fa-angle-right"></i>
                    </li>
                    <li>
                        <a href="#/GgcmsQuestionsList.html?ugroup={{currentInfo.selectUserGroup}}">试题管理</a>
                        <i class="fa fa-angle-right"></i>
                    </li>
                    <li>
                        <a href="javascript:;" data-ng-bind="$state.current.data.pageTitle"></a>
                    </li>
                </ul>
                <div class="caption font-green-sharp">
                    <i class="icon-note font-green-sharp"></i>
                    <span class="caption-subject bold uppercase" data-ng-bind="$state.current.data.pageTitle"></span>
                </div>
            </div>
            <div class="portlet-body">
                <div class="row">
                    <div class="col-xs-12">
                        <form class="form-horizontal" name="ggcmsForm" role="form" novalidate>
                            <input type="hidden" ng-model="data.Id">
                            <div class="form-body">
                                <uib-tabset active="active">
                                    <uib-tab heading="试题信息">
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Title.$invalid&&!ggcmsForm.Title.$pristine}">
                                            <label class="col-md-3 control-label">标题:</label>
                                            <div class="col-md-9">
                                                <input type="text" name="Title" minlength="2" maxlength="200" class="form-control" placeholder="请输入试题标题" required ng-model="data.Title">
                                                <div class="help-block" ng-show="ggcmsForm.Title.$invalid&&!ggcmsForm.Title.$pristine"> 请输入试题标题 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.UserGroup.$invalid&&!ggcmsForm.UserGroup.$pristine}">
                                            <label class="col-md-3 control-label">选择用户组:</label>
                                            <div class="col-md-9 pd-t-8">
                                                <input type="hidden" required name="UserGroup" id="UserGroup" ng-model="data.UserGroups">
                                                <label class="mt-checkbox mt-checkbox-outline mt-checkbox-single mg-r-10" ng-repeat="item in currentInfo.UserGroup">
                                                    <input type="checkbox" ng-click="userGroupCheck(item)" class="group-checkable" ng-model="item.checked" /> {{item.Dkey}} <span></span> 
                                                </label>
                                                <div class="help-block" ng-show="ggcmsForm.UserGroup.$invalid&&!ggcmsForm.UserGroup.$pristine"> 请选择用户组 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Qtype.$invalid&&!ggcmsForm.Qtype.$pristine}">
                                            <label class="col-md-3 control-label">试题类型:</label>
                                            <div class="col-md-9">
                                                <select ng-change="answerInit()" class="form-control input-medium" name="Qtype" id="Qtype" ng-model="data.Qtype" ng-options="kv.type as kv.name for kv in sysDicts.questType"></select>
                                                <div class="help-block" ng-show="ggcmsForm.Qtype.$invalid&&!ggcmsForm.Qtype.$pristine"> 请选择试题类型 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Content.$invalid&&!ggcmsForm.Content.$pristine}">
                                            <label class="col-md-3 control-label">试题内容:</label>
                                            <div class="col-md-9">
                                                <summernote config="editoptions" id="Content" name="Content" class="form-control" placeholder="试题内容" ng-model="data.Content" on-image-upload="editSvr.imagesUpload(files,'Content')" on-media-delete="editSvr.fileClear(target)"></summernote>
                                                <div class="help-block" ng-show="ggcmsForm.Content.$invalid&&!ggcmsForm.Content.$pristine"> 试题内容不能为空 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-if="false" ng-class="{'has-error' : ggcmsForm.Tutorialid.$invalid&&!ggcmsForm.Tutorialid.$pristine}">
                                            <label class="col-md-3 control-label">关联教程</label>
                                            <div class="col-md-9">
                                                <input type="text" name="Tutorialid" class="form-control" placeholder="选择关联教程" required ng-model="data.Tutorialid" typeahead-editable="false" uib-typeahead="state as state.Title for state in getTutorial($viewValue)" typeahead-show-hint="true" typeahead-min-length="0"
                                                />
                                                <div class="help-block" ng-show="ggcmsForm.Tutorialid.$invalid&&!ggcmsForm.Tutorialid.$pristine"> 请选择关联教程 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-if="false" ng-class="{'has-error' : ggcmsForm.Score.$invalid&&!ggcmsForm.Score.$pristine}">
                                            <label class="col-md-3 control-label">得分设置</label>
                                            <div class="col-md-9">
                                                <input type="number" name="Score" min="0" max="100" class="form-control input-medium" placeholder="Score" ng-model="data.Score">
                                                <div class="help-block" ng-show="ggcmsForm.Score.$invalid&&!ggcmsForm.Score.$pristine"> 得分设置 </div>
                                            </div>
                                        </div>
                                    </uib-tab>
                                    <uib-tab heading="试题答案">
                                        <div class="clearfix mg-b-20">
                                            <button class="btn green-haze btn-outline sbold uppercase" ng-click="answerAdd()"> <i class="fa fa-plus"></i> 添加答案 </button>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-md-12">
                                                <input type="hidden" name="Answer" class="form-control" placeholder="Answer" required ng-model="data.Answer">
                                                <div class="alert alert-danger" ng-show="ggcmsForm.Answer.$invalid"> 请选择正确答案 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.{{item.btnName}}.$invalid&&!ggcmsForm.{{item.btnName}}.$pristine}" ng-repeat="item in data.OptionsList | filter:{DelTag:'!-1'} | orderBy:'Sortid'">
                                            <div class="col-sm-1 control-label text-left">
                                                <label class="mt-checkbox mt-checkbox-outline" ng-if="data.Qtype==2" ng-click="answerSet($event,item.Sortid)">
                                                    答案{{answerLetter(item.Sortid)}}
                                                    <input type="checkbox" class="group-checkable" ng-checked="data.Answer.indexOf(answerLetter(item.Sortid))!=-1" /><span></span> 
                                                </label>
                                                <label class="mt-radio mt-radio-outline" ng-if="data.Qtype!=2" ng-click="answerSet($event,item.Sortid)">
                                                    答案{{answerLetter(item.Sortid)}}
                                                    <input type="radio" value="1" name="answerRadio" ng-checked="answerLetter(item.Sortid)==data.Answer" /><span></span>
                                                </label>
                                            </div>
                                            <div class="col-sm-5">
                                                <input type="text" ng-model="item.Answer" name="answer_{{item.nid}}" id="answer_{{item.nid}}" maxlength="200" class="form-control" placeholder="请填写答案信息">
                                            </div>
                                            <div class="col-sm-2">
                                                <div class="clearfix">
                                                    <div class="btn-group">
                                                        <a href="javascript:;" class="btn blue btn-outline" ng-if="item.Sortid>1" ng-click="answerUpDown(item,-1.5)"> <i class="fa fa-angle-double-up"></i> </a>
                                                        <a href="javascript:;" class="btn blue btn-outline" ng-if="item.Sortid<answerCount()" ng-click="answerUpDown(item,1.5)"> <i class="fa fa-angle-double-down"></i> </a>
                                                        <a href="javascript:;" class="btn red btn-outline" ng-if="item.Sortid>2" ng-click="answerDelete(item)"> <i class="fa fa-times"></i> </a>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-sm-4">
                                                <button class="btn blue" type="button" ngf-select="editSvr.fileUpload($file,item,false,0)" ng-model="item.file" name="{{item.btnName}}" ngf-pattern="'image/*'" ngf-accept="'image/*'" ngf-max-size="200KB">
                                                    <i class="fa fa-paperclip"></i> 选择图片 
                                                </button>
                                                <button class="btn green" type="button" name="{{item.btnName}}Preview" ng-if="item.FileType.indexOf('image')==0" ng-click="editSvr.filePreview(item)"> <i class="icon-eye"></i> 预览 </button>
                                                <button class="btn red" type="button" name="{{item.btnName}}Clear" ng-if="item.AnswerPic" ng-click="editSvr.fileClear(item)"> <i class="icon-trash"></i> 清除 </button>
                                                <div class="help-block" ng-show="ggcmsForm.{{item.btnName}}.$invalid&&!ggcmsForm.{{item.btnName}}.$pristine"> 图片必须小于200KB </div>
                                            </div>
                                        </div>

                                    </uib-tab>
                                </uib-tabset>
                            </div>
                            <div class="form-actions">
                                <hr/>
                                <div class="row">
                                    <div class="col-md-12 text-center">
                                        <button class="btn green" ng-click="saveData(data)" ng-disabled="ggcmsForm.$invalid||saveing"> <span class="fa fa-save"></span> 保存</button>
                                    </div>
                                </div>
                            </div>
                        </form>

                    </div>
                </div>
            </div>
        </div>
        <!-- END: ACCORDION DEMO -->
    </div>
</div>
<!-- END MAIN CONTENT -->